package com.jkhan.demo.proxy;

/**
 * @ClassName StaticProxy
 * @Description StaticProxy
 * @Author hjk
 * @Date 2022/3/6 13:54
 **/
public class StaticProxy {
    public static void main(String[] args) {
        NikeClothFactory nikeClothFactory = new NikeClothFactory();

        ProxyClothFactory proxyClothFactory = new ProxyClothFactory(nikeClothFactory);

        proxyClothFactory.produceCloth();
    }
}

interface ClothFactory {
    void produceCloth();
}

class ProxyClothFactory implements ClothFactory {

    private ClothFactory factory;

    public ProxyClothFactory(ClothFactory factory) {
        this.factory = factory;
    }


    @Override
    public void produceCloth() {
        System.out.println("prepare ing......");

        factory.produceCloth();

        System.out.println("exit ing......");
    }
}

class NikeClothFactory implements ClothFactory {

    @Override
    public void produceCloth() {
        System.out.println("nike cloths produce......");
    }
}